using System;
using System.ComponentModel;
using SF.Code.Extension.HttpHelper.Downloader;
using SG.Ling.AutoTranslator.Common;

namespace SG.Ling.AutoTranslator.Translation
{
    public class TranslationCache : MemCacheEsentDBResultCache<TranslationKey, TranslationTuple, TranslationRecord>
    {
        public TranslationCache(IContainer container)
            : base(container, TranslationTuple.Create)
        {
        }

        #region Overrides of MemCacheEsentDBResultCache<TranslationKey,TranslationTuple,TranslationRecord>

        protected override void RegisterCleanupHandler(EventHandler cleanup)
        {
            Infrastructure.BeforeClose += cleanup;
        }

        protected override void DeregisterCleanupHandler(EventHandler cleanup)
        {
            Infrastructure.BeforeClose -= cleanup;
        }

        #endregion
    }
}